|
|
|
|
|
|
|
In your example, you display the VolumeID property of the Drive object. It would be nice to also display a more informative description. You can accomplish this by creating a custom function, sDescription, that returns a description for a given volume: |
|
|
|
|
|
|
|
|
Function sDescription(sVolID)
Select Case UCase(sVolID)
Case "BACKUP0398"
sDescription = "Backup of critical files 3/98"
Case "DN_60ENUD2"
sDescription = "Developer's Network CD #2"
'
' Add more descriptions here
'
Case Else
sDescription = "Unknown"
End Select
End Function |
|
|
|
|
|
|
|
|
You can create your own subroutines and functions in ASP files, just like Visual Basic. To create the sDescription function, simply enter the function at the top of the section of VBScript code. The scope of the function will be for the current ASP page; you can call it just like a standard VB function: |
|
|
|
|
|
|
|
|
Response.Write sDescription(objDrive.VolumeName) |
|
|
|
|
|
|
|
|
The final ASP page, with table and description enhancements, is shown in Figure 31.3. |
|
|
|
|
|
|
|
|
Figure 31.3
An ASP file displays disk information. |
|
|
|
|
|
|
|
|
When you write VBScript code in Active Server Pages, you can create functions and subroutines at the beginning of your page and call them throughout the Active Server Page. You might, for example, create a subroutine that accepts a number and generates HTML based on the number: |
|
|
|
|
|